/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Product.java
 *
 * Created on Nov 17, 2011, 1:03:28 AM
 */
package VIMS;

import java.awt.Image;
import java.awt.Toolkit;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;
import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.MaskFormatter;
/**
 *
 * @author Alex
 */
public class Product extends javax.swing.JFrame {

    private Database dbOB = new Database();
    private ResultSet rset = null;
    private String action ="";
    private String selectedID=null;
    
    /** Creates new form Product */
    public Product() {
        super("Add New Employee");
        initComponents();
        setLocationRelativeTo(null);
    }

    public Product(String choice,String selectedRowID) 
    {
        super(choice+" Employee");
        initComponents();
        setLocationRelativeTo(null);  
        action=choice;
        selectedID=selectedRowID;
        
        if(action.equals("Add"))
        {
            ProductButton.setText(action);
            //NextEmpID();
            //FormattedField();
            //GroupButton();
        }
        if(action.equals("Delete"))
        {
            ProductButton.setText(action);
            //ComponentDISABLED();
            //DisplayEmpInfo();
            //GroupButton();
        }
//        if(action.equals("View"))
//        {
//            ProductButton.setText("Edit");
//            //Position.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"Planning Manager", "Head of Logistic", "Clerk", "Administrator" }));
//            //ComponentDISABLED();
//            //DisplayEmpInfo();
//            //GroupButton();
//        }
    }
    
    
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLayeredPane1 = new javax.swing.JLayeredPane();
        Photo = new javax.swing.JLabel();
        CancelButton = new javax.swing.JButton();
        NumberLabel = new javax.swing.JLabel();
        NameLabel = new javax.swing.JLabel();
        VolumeLabel = new javax.swing.JLabel();
        PackageLabel = new javax.swing.JLabel();
        PriceLabel = new javax.swing.JLabel();
        ProductLevelLabel = new javax.swing.JLabel();
        NumberField = new javax.swing.JLabel();
        NameTextField = new javax.swing.JTextField();
        VolumeComboBox = new javax.swing.JComboBox();
        PackageComboBox = new javax.swing.JComboBox();
        PriceTextField = new javax.swing.JTextField();
        ProductLevelTextField = new javax.swing.JTextField();
        Border = new javax.swing.JLabel();
        ProductButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(800, 600));

        Photo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        Photo.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        Photo.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        Photo.setBounds(30, 50, 320, 470);
        jLayeredPane1.add(Photo, javax.swing.JLayeredPane.DEFAULT_LAYER);

        CancelButton.setText("Cancel");
        CancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CancelButtonActionPerformed(evt);
            }
        });
        CancelButton.setBounds(660, 550, 80, 30);
        jLayeredPane1.add(CancelButton, javax.swing.JLayeredPane.DEFAULT_LAYER);

        NumberLabel.setText("Number  :");
        NumberLabel.setBounds(390, 70, 120, 30);
        jLayeredPane1.add(NumberLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        NameLabel.setText("Name  :");
        NameLabel.setBounds(390, 110, 120, 30);
        jLayeredPane1.add(NameLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        VolumeLabel.setText("Volume  :");
        VolumeLabel.setBounds(390, 150, 120, 30);
        jLayeredPane1.add(VolumeLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        PackageLabel.setText("Package  :");
        PackageLabel.setBounds(390, 190, 120, 30);
        jLayeredPane1.add(PackageLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        PriceLabel.setText("Price (Each)  :");
        PriceLabel.setBounds(390, 230, 120, 30);
        jLayeredPane1.add(PriceLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        ProductLevelLabel.setText("Product Level  :");
        ProductLevelLabel.setBounds(390, 270, 120, 30);
        jLayeredPane1.add(ProductLevelLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        NumberField.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        NumberField.setBounds(550, 74, 180, 30);
        jLayeredPane1.add(NumberField, javax.swing.JLayeredPane.DEFAULT_LAYER);
        NameTextField.setBounds(550, 110, 180, 30);
        jLayeredPane1.add(NameTextField, javax.swing.JLayeredPane.DEFAULT_LAYER);

        VolumeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0.325", "0.5", "1.5" }));
        VolumeComboBox.setBounds(550, 150, 90, 30);
        jLayeredPane1.add(VolumeComboBox, javax.swing.JLayeredPane.DEFAULT_LAYER);

        PackageComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "CAN", "BOTTLE", "L_BOTTLE" }));
        PackageComboBox.setBounds(550, 190, 90, 30);
        jLayeredPane1.add(PackageComboBox, javax.swing.JLayeredPane.DEFAULT_LAYER);
        PriceTextField.setBounds(550, 230, 180, 30);
        jLayeredPane1.add(PriceTextField, javax.swing.JLayeredPane.DEFAULT_LAYER);
        ProductLevelTextField.setBounds(550, 270, 180, 30);
        jLayeredPane1.add(ProductLevelTextField, javax.swing.JLayeredPane.DEFAULT_LAYER);

        Border.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        Border.setBorder(javax.swing.BorderFactory.createTitledBorder("Product's Details :"));
        Border.setBounds(370, 50, 400, 270);
        jLayeredPane1.add(Border, javax.swing.JLayeredPane.DEFAULT_LAYER);

        ProductButton.setText("Product");
        ProductButton.setBounds(573, 550, 80, 30);
        jLayeredPane1.add(ProductButton, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 800, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void CancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelButtonActionPerformed

        this.setVisible(false);     }//GEN-LAST:event_CancelButtonActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Product.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Product.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Product.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Product.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Product().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel Border;
    private javax.swing.JButton CancelButton;
    private javax.swing.JLabel NameLabel;
    private javax.swing.JTextField NameTextField;
    private javax.swing.JLabel NumberField;
    private javax.swing.JLabel NumberLabel;
    private javax.swing.JComboBox PackageComboBox;
    private javax.swing.JLabel PackageLabel;
    private javax.swing.JLabel Photo;
    private javax.swing.JLabel PriceLabel;
    private javax.swing.JTextField PriceTextField;
    private javax.swing.JButton ProductButton;
    private javax.swing.JLabel ProductLevelLabel;
    private javax.swing.JTextField ProductLevelTextField;
    private javax.swing.JComboBox VolumeComboBox;
    private javax.swing.JLabel VolumeLabel;
    private javax.swing.JLayeredPane jLayeredPane1;
    // End of variables declaration//GEN-END:variables
}
